from problems import parse_problem
import graphic_problems_2
from astar_solution import astar_solution
from heuristics import  manhattan_dirt
import matplotlib.pyplot as plt
from numpy import arange

problems = {}
times = []
indexes = []

for (k,p) in graphic_problems_2.p.items():
    p_ = parse_problem(p)
    t,s=astar_solution(manhattan_dirt()).solve(p_)
    problems[t] = k
    times.append(t)

    
#times = [0.020000000000000018, 0.030000000000001137, 0.039999999999999147, 0.91000000000000014, 2.1000000000000001, 2.6799999999999997, 2.6799999999999997, 3.2000000000000002, 4.6500000000000021, 17.59]
times.sort()
print times

ax = plt.subplot(111)

width = 0.15  
bars={}
i = 0
for t in times:
    bars[t]= plt.bar(i, t, width)
    indexes.append(problems[t])
    i += 1

ind = arange(len(times))
ax.set_xticks(ind+width)
ax.set_xticklabels(indexes)

plt.show()
